home *** CD-ROM | disk | FTP | other *** search
/ Aminet 5 / Aminet 5 - March 1995.iso / Aminet / dev / misc / LEDA_gene.lha / LEDA-3.1c-generic / incl / LEDA / b_prio.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-05  |  1.5 KB  |  53 lines

  1. /*******************************************************************************
  2. +
  3. +  LEDA  3.1c
  4. +
  5. +
  6. +  b_prio.h
  7. +
  8. +
  9. +  Copyright (c) 1994  by  Max-Planck-Institut fuer Informatik
  10. +  Im Stadtwald, 6600 Saarbruecken, FRG     
  11. +  All rights reserved.
  12. *******************************************************************************/
  13.  
  14.  
  15. #ifndef LEDA_BPRIO_H
  16. #define LEDA_BPRIO_H
  17.  
  18. //------------------------------------------------------------------------------
  19. // b_priority_queues: bounded priority queues implemented by b_heaps 
  20. //------------------------------------------------------------------------------
  21.  
  22. #include <LEDA/impl/b_heap.h>
  23.  
  24. typedef b_heap_item b_pq_item;
  25.  
  26.  
  27. template<class keytype> 
  28.  
  29. class _CLASSTYPE b_priority_queue : public b_heap 
  30. {
  31. public:
  32.  
  33.          b_priority_queue(int a, int b): (a,b)  {}
  34. virtual ~b_priority_queue()  { }
  35.  
  36.   b_pq_item insert(keytype k,int info)
  37.                              { return b_heap::insert(info,Convert(k)); }
  38.   void decrease_inf(b_pq_item it,int newinf)
  39.                              { b_heap::decrease_key(it,newinf); }
  40.   void del_item(b_pq_item x) { b_heap::delete_item(x); }
  41.   int      inf(b_pq_item x)  { return b_heap::key(x); }
  42.   keytype  key(b_pq_item x)  { return ACCESS(keytype,b_heap::info(x)); }
  43.   keytype  del_min()         { return ACCESS(keytype,b_heap::del_min()); }
  44.   b_pq_item find_min()       { return b_heap::find_min(); }
  45.   void clear()               { b_heap::clear(); }
  46.   int empty()                { return (find_min()==0) ? true : false; }
  47.  };
  48.  
  49.  
  50. #endif
  51.  
  52.